-
-
Notifications
You must be signed in to change notification settings - Fork 528
Expose original request on Middleware.onResponse #1697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose original request on Middleware.onResponse #1697
Conversation
|
78fe9b8
to
9f8e465
Compare
| `options` | `MergedOptions` | Combination of [createClient](/openapi-fetch/api#create-client) options + [fetch overrides](/openapi-fetch/api#fetch-options) | | ||
| `req` | `MiddlewareRequest` | A standard [Request](https://developer.mozilla.org/en-US/docs/Web/API/Request) with `schemaPath` (OpenAPI pathname) and `params` ([params](/openapi-fetch/api#fetch-options) object) | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `req` | `MiddlewareRequest` | A standard [Request](https://developer.mozilla.org/en-US/docs/Web/API/Request) with `schemaPath` (OpenAPI pathname) and `params` ([params](/openapi-fetch/api#fetch-options) object) | | |
| `req` | `MiddlewareRequest` | The original [Request](https://developer.mozilla.org/en-US/docs/Web/API/Request), see `onRequest` | |
export function onResponse( | ||
res: Response, | ||
options: MergedOptions, | ||
req: MiddlewareRequest, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 This is a good non-breaking change. Will probably opt for a more “logical” ordering in a future breaking change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great addition. Thanks for adding! There’s no reason not to have this available, and it wasn’t ever omitted intentionally.
Two suggestions for the v7:
|
@armandabric suggestions taken, and updated in |
Changes
Add the
req
as thrid params of the onResponse middleware. Its useful to create log on the on response (theResponse
did not contains some information of the original request)Checklist
docs/
updated (if necessary) (will be done if